package com.eb.buybuybuy.result;

import com.alibaba.fastjson.JSON;

public class Result {
    private String msg;
    private boolean isSuccess;
    private Object data;

    public static String success() {
        Result result = new Result(null, true, null);
        return JSON.toJSONString(result);
    }

    public static String success(Object data) {
        Result result = new Result(null, true, data);
        return JSON.toJSONString(result);
    }

    public static String error(String msg) {
        Result result = new Result(msg, false, null);
        return JSON.toJSONString(result);
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public void setSuccess(boolean success) {
        isSuccess = success;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Result(String msg, boolean isSuccess, Object data) {
        this.msg = msg;
        this.isSuccess = isSuccess;
        this.data = data;
    }
}
